/****************************************************************************\
 Datei  : Thread.h
 Projekt: T2 - Terminalkommunikation
 Inhalt : CThread Deklaration
 Datum  : 25.07.2000
 Autor  : CR - Christian Rodemeyer
 Hinweis: 
 Stempel: $Modtime: 3.01.01 12:07 $, $Author: Cr $, $NoKeywords: $ 
\****************************************************************************/
#pragma once

#ifndef __THREAD_H
#define __THREAD_H

#include "Event.h"

namespace SYS {

/****************************************************************************\
 CThread: Deklaration
\****************************************************************************/
class CThread
{
protected:
  CThread();
  virtual ~CThread();

public:  
  virtual void Start();
  virtual bool IsStarted();
  virtual void Stop();

protected:
  virtual void Run() = 0;

  CAutoEvent m_sigStop;
  HANDLE     m_thread;
  DWORD      m_threadId;
  DWORD      m_killTimeout; // 10s by default

private:

  static DWORD WINAPI ThreadRun(CThread* pThis);
};

}; // namespace SYS

#endif 